package cn.edu.baiyunu.myapplication.ui.screens.transactions.components

import androidx.compose.foundation.layout.Column
import androidx.compose.foundation.layout.Spacer
import androidx.compose.foundation.layout.height
import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.text.font.FontWeight
import androidx.compose.ui.text.style.TextAlign
import androidx.compose.ui.unit.dp
import androidx.compose.ui.unit.sp

/**
 * 交易详情头部组件，显示交易金额和类型
 * 
 * @param amount 交易金额
 * @param isExpense 是否为支出交易
 * @param modifier 修饰符
 */
@Composable
fun TransactionDetailHeader(
    amount: Double,
    isExpense: Boolean,
    modifier: Modifier = Modifier
) {
    val formattedAmount = if (isExpense) "-${amount}" else "+${amount}"
    val amountColor = if (isExpense) Color(0xFFFF5E62) else Color(0xFF26DE81)
    
    Column(
        modifier = modifier,
        horizontalAlignment = Alignment.CenterHorizontally
    ) {
        // 金额显示
        Text(
            text = formattedAmount,
            fontSize = 36.sp,
            fontWeight = FontWeight.Bold,
            color = amountColor,
            textAlign = TextAlign.Center
        )
        
        Spacer(modifier = Modifier.height(5.dp))
        
        // 类型标签
        Text(
            text = if (isExpense) "支出" else "收入",
            fontSize = 14.sp,
            color = Color.White.copy(alpha = 0.7f),
            textAlign = TextAlign.Center
        )
    }
} 